package Thread.Test.Test6;

import java.util.Collections;

public class award_p2 extends Thread{
    @Override
    public void run() {
        while (true) {

            synchronized (jackpot_p.lock) {
                if (jackpot_p.list.isEmpty()) {
                    break;
                }
                //打乱集合的数据
                Collections.shuffle(jackpot_p.list);
                int award = jackpot_p.list.get(0);
                jackpot_p.list.remove(0);
                //产生了奖项
                //将奖项存放到集合中
                jackpot_p.list_push2.add(award);
                //记录总钱数
                jackpot_p.sum_award_2 +=award;
                //记录最大值
                jackpot_p.max_award_2 = jackpot_p.Max_List(jackpot_p.list_push2);
                try {
                    sleep(10);
                } catch (InterruptedException e) {
                    throw new RuntimeException(e);
                }
            }
        }
        jackpot_p.Test_print(jackpot_p.list_push2,2);


    }
}
